﻿using UnityEngine;
using System.Collections;

public class KeyboardInputHelper {

	public bool Ctrl { get; private set; }
	public bool Shift { get; private set; }
	public bool Alt { get; private set; }
	
	public KeyboardInputHelper() {
		Ctrl = false;
		Shift = false;
		Alt = false;
	}
	
	public void UpdateState() {
		
		bool startCtrl = Ctrl;
		bool startShift = Shift;
		bool startAlt = Alt;
		
		if (Input.GetKeyUp(KeyCode.LeftControl) || Input.GetKeyUp(KeyCode.RightControl)) Ctrl = false;
		if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) Ctrl = true;
		
		if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift)) Shift = false;
		if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) Shift = true;
		
		if (Input.GetKeyUp(KeyCode.LeftAlt) || Input.GetKeyUp(KeyCode.RightAlt)) Alt = false;
		if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) Alt = true;
		
		if (Ctrl != startCtrl) MonoBehaviour.print ("Ctrl changed to " + Ctrl.ToString());
		if (Shift != startShift) MonoBehaviour.print ("Shift changed to " + Shift.ToString());
		if (Alt != startAlt) MonoBehaviour.print ("Alt changed to " + Alt.ToString());
		
	}

}
